set nocompatible                  " Must come first because it changes other options.

syntax enable                     " Turn on syntax highlighting.
filetype plugin indent on         " Turn on file type detection.

set hidden                        " Handle multiple buffers better.

set title                         " Set the terminal's title

set showcmd                       " Display incomplete commands.
set showmode                      " Display the mode you're in.
set number                        " Display line numbers.
"set ruler                         " Display cursor position.

set backspace=indent,eol,start    " Intuitive backspacing.

set wildmenu                      " Enhanced command line completion.
set wildmode=list:longest         " Complete files like a shell.

" Searching options.
set incsearch
set hlsearch
set ignorecase
set smartcase

" Turn on line wrapping.
set wrap

" Show 3 lines of context around the cursor.
set scrolloff=3

" No beeping.
set visualbell

" Backup policies: "DON'T BACKUP"
set nobackup
set nowritebackup

set directory=$HOME/.vim/tmp//,.  " Keep swap files in one location

" Global tab settings.
set tabstop=4
set shiftwidth=4

" Generally, I don't like folding.
set nofoldenable

" Show the status line all the time
set laststatus=2

" Useful status information at bottom of screen
set statusline=[%n:%f]%m%r\ Ln:%l/%L,\ Col:%c,\ Ch:%o(0x%B)%=\ --%p%%--

" get rid of the silly characters in window separators
set fillchars=""

" Use the best mapleader
let mapleader=","

" Fast switching between .h, .cpp files
nnoremap <leader><leader> <C-^>

" Easier navigation between split windows
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

if has("autocmd")
	autocmd FileType ruby   setlocal foldmethod=syntax shiftwidth=2 tabstop=2 expandtab
	autocmd FileType python setlocal foldmethod=indent shiftwidth=4 tabstop=4 expandtab
endif

if has("gui_running")
	set encoding=utf-8                " Use UTF-8 everywhere.
	set background=dark               " Background.
	set lines=40 columns=120          " Window dimensions.
	set guifont=Monaco:h14            " Font family and font size.
	set antialias                     " MacVim: smooth fonts.
	set guioptions-=T                 " Hide toolbar.
	set guioptions-=r                 " Don't show right scrollbar

	colorscheme railscasts
endif
